<?php
/**
 * Created by PhpStorm
 * User: honglin
 * Date: 2022/8/2
 * Time: 下午4:05
 */

namespace App\Controller\Admin\Login;

use App\Controller\AbstractController;
use App\Service\Login\LoginService;
use Hyperf\Di\Annotation\Inject;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;

/**
 * @ApiController(prefix="admin/login")
 */
class LoginController extends AbstractController
{

    /**
     * @Inject()
     * @var LoginService
     */
    protected $loginService;

    /**
     * @PostApi(path="login")
     * @FormData(key="username")
     * @FormData(key="password")
     */
    public function login(){
        $params = $this->getParams();
        //登录
        $data = $this->loginService->login($params->get('username'),$params->get('password'));
        _SUCCESS($data);

    }
}